package com.wuseguang.springcloud.service;

import com.wuseguang.springcloud.client.ServiceList;
import com.wuseguang.springcloud.service.impl.AdminManagementServiceFallbackFactory;
import com.wuseguang.springcloud.util.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(value = ServiceList.MICROSERVICECLOUD_ADMINMANAGEMENT, path = "/admin", fallbackFactory = AdminManagementServiceFallbackFactory.class)
public interface AdminManagementService {

    @RequestMapping("/queryPersonDataByRole")
    Result queryPersonDataByRole();


    /**
     * @描述 运营人员添加修改数据/添加
     * @创建人 zm
     * @创建时间 2020/5/4
     */
    @RequestMapping("/addPersonData")
    Result addPersonData(@RequestParam(value = "id", required = false) Integer id,
                         @RequestParam(value = "head_portrait", required = false) String head_portrait,
                         @RequestParam(value = "admin_name", required = false) String admin_name,
                         @RequestParam(value = "phone") String phone,
                         @RequestParam(value = "password") String password);

    /**
     * @描述 根据id查个人信息
     * @创建人 zm
     * @创建时间 2020/5/4
     */
    @RequestMapping("/queryPersonDataById")
    Result queryPersonDataById(@RequestParam(value = "id") Integer id);

    /**
     * @描述 添加/修改代理商信息
     * @创建人 zm
     * @创建时间 2020/5/4
     */
    @RequestMapping("/addAgentData")
    Result addAgentData(@RequestParam(value = "id", required = false) Integer id,
                        @RequestParam(value = "head_portrait", required = false) String head_portrait,
                        @RequestParam(value = "corporate_name", required = false) String corporate_name,
                        @RequestParam(value = "address", required = false) String address,
                        @RequestParam(value = "phone") String phone,
                        @RequestParam(value = "password") String password);

    /**
     * @描述 删除人员信息
     * @创建人 zm
     * @创建时间 2020/5/4
     */
    @RequestMapping("/delPersonData")
    Result delPersonData(@RequestParam(value = "id") Integer id);


    /**
     * @描述 查所有的省->市->区
     * @创建人 zm
     * @创建时间 2020/5/4
     */
    @RequestMapping("/queryDistrict")
    Result queryDistrict(@RequestParam(value = "id", required = false) Integer id,
                         @RequestParam(value = "type", required = false) Integer type);

    /**
     * @描述 查所有的学校
     * @创建人 zm
     * @创建时间 2020/5/4
     */
    @RequestMapping("/querySchoolAll")
    Result querySchoolAll(@RequestParam(value = "name", required = false) String name,
                          @RequestParam(value = "id", required = false) Integer id,
                          @RequestParam(value = "type", required = false) Integer type,
                          @RequestParam(value = "indexNo", required = false, defaultValue = "1") Integer indexNo,
                          @RequestParam(value = "rows", required = false, defaultValue = "20") Integer rows);


    /**
     * @描述 修改学校信息
     * @创建人 zm
     * @创建时间 2020/5/5
     */
    @RequestMapping("/updateSchoolDate")
    Result updateSchoolDate(@RequestParam(value = "sid") Integer sid,//学校id
                            @RequestParam(value = "sname", required = false) String sname,//学校名字
                            @RequestParam(value = "logo", required = false) String logo,
                            @RequestParam(value = "districtId") Integer districtId,//地区id
                            @RequestParam(value = "tid", required = false) Integer tid,//教师id
                            @RequestParam(value = "tname", required = false) String tname,//教师名字
                            @RequestParam(value = "phone") String phone,//电话
                            @RequestParam(value = "password") String password,//密码
                            @RequestParam(value = "endtime", required = false) String endtime,//失效时间
                            @RequestParam(value = "sbnumber") Integer sbnumber);


    /**
     * @描述 添加学校信息
     * @创建人 zm
     * @创建时间 2020/5/5
     */
    @RequestMapping("/addSchoolDate")
    Result addSchoolDate(@RequestParam(value = "sname", required = false) String sname,
                         @RequestParam(value = "logo", required = false) String logo,
                         @RequestParam(value = "districtId") Integer districtId,
                         @RequestParam(value = "tname", required = false) String tname,
                         @RequestParam(value = "phone") String phone,
                         @RequestParam(value = "password") String password,
                         @RequestParam(value = "endtime", required = false) String endtime,
                         @RequestParam(value = "sbnumber") Integer sbnumber);

    /**
     * @描述 根据id查学校信息
     * @创建人 zm
     * @创建时间 2020/5/5
     */
    @RequestMapping("/querySchoolDateById")
    Result querySchoolDateById(@RequestParam(value = "id") Integer id);

    /**
     * @描述 查询该学校功能权限
     * @创建人 zm
     * @创建时间 2020/5/6
     */
    @RequestMapping("/querySchoolManagementJurisdiction")
    Result querySchoolManagementJurisdiction(@RequestParam(value = "id") Integer id);

    /**
     * @描述 添加菜单权限
     * @创建人 zm
     * @创建时间 2020/5/6
     */
    @RequestMapping("/addSchoolManagementJurisdiction")
    Result addSchoolManagementJurisdiction(@RequestParam(value = "menuOne", required = false) String menuOne, @RequestParam(value = "menuTwo", required = false) String menuTwo, @RequestParam(value = "id") Integer id);

    /**
     * @描述 添加学期
     * @创建人 zm
     * @创建时间 2020/5/8
     */
    @RequestMapping("/addSchoolSemester")
    Result addSchoolSemester(@RequestParam(value = "name") String name,
                             @RequestParam(value = "schoolId") Integer schoolId,
                             @RequestParam(value = "oneTerm") String oneTerm,
                             @RequestParam(value = "oneTime") String oneTime,
                             @RequestParam(value = "twoTerm") String twoTerm,
                             @RequestParam(value = "twoTime") String twoTime);

    /**
     * @描述 修改学年信息
     * @创建人 zm
     * @创建时间 2020/5/8
     */
    @RequestMapping("/updateSchoolSemester")
    Result updateSchoolSemester(@RequestParam(value = "id") Integer id,
                                @RequestParam(value = "name") String name,
                                @RequestParam(value = "schoolId") Integer schoolId,
                                @RequestParam(value = "oneTerm") String oneTerm,
                                @RequestParam(value = "oneTime") String oneTime,
                                @RequestParam(value = "twoTerm") String twoTerm,
                                @RequestParam(value = "twoTime") String twoTime);


    /**
     * @描述 设置为当前学年
     * @创建人 zm
     * @创建时间 2020/5/8
     */
    @RequestMapping("/updateSemesterState")
    Result updateSemesterState(@RequestParam(value = "id") Integer id,
                               @RequestParam(value = "schoolId") Integer schoolId);

    /**
     * @描述 根据id查学年信息
     * @创建人 zm
     * @创建时间 2020/5/8
     */
    @RequestMapping("/querySemesterById")
    Result querySemesterById(@RequestParam(value = "id") Integer id);

    /**
     * @描述 根据学校id查学年信息
     * @创建人 zm
     * @创建时间 2020/5/8
     */
    @RequestMapping("/querySemesterBySchoolId")
    Result querySemesterBySchoolId(@RequestParam(value = "schoolId") Integer schoolId);

    /**
     * @描述 组合查询学校学年
     * @创建人 zm
     * @创建时间 2020/5/8
     */
    @RequestMapping("/querySemesterSchoolList")
    Result querySemesterSchoolList(@RequestParam(value = "name", required = false) String name,
                                   @RequestParam(value = "indexNo", required = false, defaultValue = "1") Integer indexNo,
                                   @RequestParam(value = "rows", required = false, defaultValue = "20") Integer rows);

    /**
     * @描述 升学年
     * @创建人 zm
     * @创建时间 2020/5/8
     */
    @RequestMapping("/updateSchoolUpgrade")
    Result updateSchoolUpgrade(@RequestParam(value = "schoolId") Integer schoolId, @RequestParam(value = "id") Integer id);


    /**
     * @描述 查学年id
     * @创建人 zm
     * @创建时间 2020/5/16
     */
    @RequestMapping("/querySemesterYearId")
    Result querySemesterYearId(@RequestParam(value = "schoolId") Integer schoolId);

    @PostMapping(value = "/adminUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    Result upload(@RequestPart("file") MultipartFile file, @RequestParam("type") int type);

    /**
     * @描述 根据学校id 删除学校信息
     * @创建人 zm
     * @创建时间 2020/5/14
     */
    @RequestMapping("/delSchoolDateById")
    Result delSchoolDateById(@RequestParam(value = "id") Integer id);
}
